package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.text.format.DateUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.horizontalcard.api.card.BaseHorizontalItemCard;
import com.huawei.appmarket.framework.widget.RoundImageView;
import com.huawei.appmarket.service.store.awk.bean.CampaignCardBean;
import o.cgz;
import o.chy;
import o.dof;
import o.ContentManager;
import o.eqx;
import o.evx;
import o.ewm.e;
import o.ewm.j;
import o.ewm.n;

public class CampaignCard extends BaseHorizontalItemCard {
    private TextView ʻ;
    private TextView ʽ;
    private TextView ˋ;
    private TextView ॱॱ;
    private RoundImageView ᐝ;

    public CampaignCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˋ = (TextView) view.findViewById(j.ՙᐝ);
        this.ʽ = (TextView) view.findViewById(j.ՙˋ);
        this.ʻ = (TextView) view.findViewById(j.ˆˋ);
        this.ᐝ = (RoundImageView) view.findViewById(j.ʽˉ);
        this.ॱॱ = (TextView) view.findViewById(j.ㆍʼ);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof CampaignCardBean) {
            CampaignCardBean campaignCardBean = (CampaignCardBean) cardBean;
            ˋ(this.ॱॱ, campaignCardBean.ˋʻ());
            ᐝ(this.ʽ);
            this.ˋ.setText(campaignCardBean.v_());
            this.ʽ.setText(campaignCardBean.ʻˊ());
            this.ᐝ.setImageResource(e.ꓸ);
            ˋ(campaignCardBean.ॱˌ(), this.ᐝ);
            long ʻᐝ = campaignCardBean.ʻᐝ();
            long ʻˋ = campaignCardBean.ʻˋ();
            long ʼˊ = campaignCardBean.ʼˊ();
            this.ˋ.setAlpha(1.0f);
            this.ʽ.setAlpha(1.0f);
            this.ʻ.setAlpha(1.0f);
            String ॱ;
            if (ʼˊ < ʻᐝ) {
                ॱ = ॱ(ʻᐝ);
                this.ʻ.setText(ContentManager.getInstant().getContext().getResources().getString(n.ˎͺ, new Object[]{ॱ}));
            } else if (ʼˊ < ʻˋ) {
                ॱ = ॱ(ʻˋ);
                this.ʻ.setText(ContentManager.getInstant().getContext().getResources().getString(n.ˋʽ, new Object[]{ॱ}));
            } else {
                this.ʻ.setText(ContentManager.getInstant().getContext().getResources().getString(n.ˑॱ));
                this.ˋ.setAlpha(0.3f);
                this.ʽ.setAlpha(0.3f);
                this.ʻ.setAlpha(0.3f);
            }
        }
    }

    private String ॱ(long j) {
        return DateUtils.formatDateTime(this.ʼॱ, j, 131092);
    }

    private void ˋ(String str, ImageView imageView) {
        if (!dof.ˋ(str) && imageView != null) {
            eqx.ˏ(imageView, str, "app_default_icon");
        }
    }

    public void ॱ(final chy o_chy) {
        View ˉ = ˉ();
        if (ˉ != null) {
            OnClickListener anonymousClass2 = new evx(this) {
                final /* synthetic */ CampaignCard ˋ;

                public void ˋ(View view) {
                    if (o_chy != null) {
                        o_chy.ˏ(0, this.ˋ);
                    }
                }
            };
            ˉ.setOnClickListener(anonymousClass2);
            this.ᐝ.setOnClickListener(anonymousClass2);
        }
    }

    public void ॱ(int i) {
        ˉ().setVisibility(i);
    }
}
